<template>
<view class="c-container no-bsettlement c-container-item">
    <view class="c-row">
        <view class="c-row-col" v-if="!include(settlement.news_type,[1,8,10,9,6,4])">
            <view class="col-title">桌数</view>
            <view class="col-text">{{settlement.table_amount}}</view>
        </view>
        <view class="c-row-col" v-if="!include(settlement.news_type,[1,8,10,9,6,4])">
            <view class="col-title">餐标</view>
            <view class="col-text">{{settlement.table_price}}</view>
        </view>
    </view>
    <view class="c-row">
        <view class="c-row-col">
            <view class="col-title">订单金额</view>
            <view class="col-text">{{settlement.totals}}</view>
        </view>
        <view class="c-row-col">
            <view class="col-title">结算总价</view>
            <view class="col-text">{{settlement.settle_totals}}</view>
        </view>
    </view>
    <view class="c-row">
        <view class="c-row-col">
            <view class="col-title">结算比例</view>
            <view class="col-text">{{settlement.settle_percent}}</view>
        </view>
        <view class="c-row-col">
            <view class="col-title">结算时间</view>
            <view class="col-text">{{settlement.settle_time}}</view>
        </view>
    </view>
    <view class="c-row">
        <view class="c-row-col">
            <view class="col-title">应收结算</view>
            <view class="col-text">{{settlement.settle_real_total}}</view>
        </view>
        <view class="c-row-col">
            <view class="col-title">审核状态</view>
            <view class="col-text" :style="{ color: status[settlement.item_check_status].color }">{{status[settlement.item_check_status].title}}</view>
        </view>
    </view>
    <view class="c-row" v-if="settlement.remark">
        <view class="c-row-col">
            <view class="col-title">备注</view>
            <view class="col-text col-remark">{{settlement.remark}}</view>
        </view>
    </view>
    <view class="c-row" v-if="settlementImages.length > 0">
        <view class="c-row-col">
            <view class="col-title">附件列表</view>
            <view class="col-text col-text-img-box">
                <image class="col-img" v-for="(img, imgIndex) in settlementImages" :key="imgIndex" :src="img" @click="previewImg({list:settlementImages,index: imgIndex})"></image>
            </view>
        </view>
    </view>
</view>
</template>

<script>
import {
    include
} from '@/utils/common.js';
export default {
    props: {
        settlement: {
            type: Object,
            default () {
                return {}
            }
        },
        settlementImages: {
            type: Array,
            default () {
                return []
            }
        }
    },
    data() {
        return {
            status: {
                0: {
                    title: '待审核',
                    color: '#999'
                },
                1: {
                    title: '审核中',
                    color: '#999'
                },
                2: {
                    title: '审核通过',
                    color: '#409EFF'
                },
                3: {
                    title: '审核驳回',
                    color: 'red'
                },
                13: {
                    title: '已撤销',
                    color: '#999'
                }
            }
        }
    },
    onLoad(options) {
        console.log(options)
        console.log(settlement)
    },
    beforeMount() {

        this.include = include
    },

    methods: {
        // 预览图片
        previewImg(data) {
            uni.previewImage({
                urls: data.list,
                current: data.index
            })
        }
    }
}
</script>

<style lang="less">
@import url("../../common.less");
</style>
